<?php echo $header; ?>
<div class="page">
	<div class="personal_info">
    	<a href="/index.php?route=account/login">login</a> or <a href="/index.php?route=account/register">create an account</a>.
    </div>
    	<div class="greenPanel">
	<?php if ($error_warning) { ?>
	<div class="warning"><?php echo $error_warning; ?></div>
	<?php } ?>
    		<form action="<?php echo $action; ?>" method="post" enctype="multipart/form-data">
            <table width="615" cellspacing="0" cellpadding="0" class="register">
              <tr>
                <td colspan="3" height="35" style="background:url(catalog/view/theme/default/images/register_title.png) no-repeat center">
                    <span class="hidden">register</span>
                </td>
              </tr>
              <tr>
                <td width="45" rowspan="2" style="background:url(catalog/view/theme/default/images/register_left.png)"></td>
                <td width="*" height="415" valign="top" style="background:url(catalog/view/theme/default/images/register_bg.png)">
                    <table width="400" border="0" align="center" cellpadding="0" cellspacing="0">
                      <tr>
                        <td>
        <ul>
		<li><font class="word-red">*</font>E-mail</li>
		<li>
				<input id="email" name="email" class="input" value="<?php echo $email; ?>" />
				<?php if ($error_email) { ?>
		    <br /><span class="error"><?php echo $error_email; ?></span>
		    <?php } ?>
			</li>
		<li><font class="word-red">*</font>First  Name</li>
		<li>
			<input id="firstname" name="firstname"  class="input" value="<?php echo $firstname; ?>"/>
			<?php if ($error_firstname) { ?>
			    <br /><span class="error"><?php echo $error_firstname; ?></span>
			<?php } ?>
		</li>

		<li><font class="word-red">*</font>Last Name</li>
		<li>
			<input id="lastname" name="lastname"  class="input"  value="<?php echo $lastname; ?>" />
			<?php if ($error_lastname) { ?>
				<br /><span class="error"><?php echo $error_lastname; ?></span>
			<?php } ?>
		</li>
		<li>Fax</li>
		<li><input type="text" name="fax" class="input" value="<?php echo $fax; ?>" /></li>
		<li>Company</li>
		<li><input id="company" name="company"  class="input"  /></li>
		<li><font class="word-red">*</font>Address</li>
		<li>
			<input type="text" name="address_1" class="input" value="<?php echo $address_1; ?>" />
			<?php if ($error_address_1) { ?>
				<br /><span class="error"><?php echo $error_address_1; ?></span>
			<?php } ?>
		</li>
		<li><font class="word-red">*</font>City</li>
		<li>
			<input id="city" name="city"  class="input"  />
			<?php if ($error_city) { ?>
				<br /><span class="error"><?php echo $error_city; ?></span>
			<?php } ?>
		</li>
		<li>Post Code</li>
		<li><input id="postcode" name="postcode"  class="input"  /></li>
		<li><font class="word-red">*</font>Country</li>
		<li>
			<select name="country_id">
			      <option value=""><?php echo $text_select; ?></option>
			      <?php foreach ($countries as $country) { ?>
			      <?php if ($country['country_id'] == $country_id) { ?>
			      <option value="<?php echo $country['country_id']; ?>" selected="selected"><?php echo $country['name']; ?></option>
			      <?php } else { ?>
			      <option value="<?php echo $country['country_id']; ?>"><?php echo $country['name']; ?></option>
			      <?php } ?>
			      <?php } ?>
			</select>
		</li>
		<li><font class="word-red">*</font>Region / State</li>
		<li>
			<select name="zone_id">
			</select>
		</li>
		<li><font class="word-red">*</font>Password</li>
		<li>
				<input id="password" type="password" name="password"  class="input" value="<?php echo $password; ?>" />
				 <?php if ($error_password) { ?>
				<br /><span class="error"><?php echo $error_password; ?></span>
		     <?php } ?>
			</li>
		<li><font class="word-red">*</font>Password Confirm</li>
		<li>
				 <input id="confirm" type="password" name="confirm" class="input" value="<?php echo $confirm; ?>" />
				 <?php if ($error_confirm) { ?>
			<br /><span class="error"><?php echo $error_confirm; ?></span>
		     <?php } ?>
		</li>
		<li><font class="word-red">*</font>Telephone</li>
		<li>
				<input id="telephone" name="telephone"  class="input" value="<?php echo $telephone; ?>" />
				<?php if ($error_telephone) { ?>
			<br /><span class="error"><?php echo $error_telephone; ?></span>
		    <?php } ?>
		</li>
		<li>Newsletter Subscription</li>
		<li>
				<?php if ($newsletter) { ?>
		    <input type="radio" name="newsletter" value="1" checked="checked" />
		    <?php echo $text_yes; ?>
		    <input type="radio" name="newsletter" value="0" />
		    <?php echo $text_no; ?>
		    <?php } else { ?>
		    <input type="radio" name="newsletter" value="1" />
		    <?php echo $text_yes; ?>
		    <input type="radio" name="newsletter" value="0" checked="checked" />
		    <?php echo $text_no; ?>
		    <?php } ?>
		</li>
			<li>
				 <?php if ($agree) { ?>
			<input type="checkbox" name="agree" value="1" checked="checked" />
			<?php } else { ?>
			<input type="checkbox" name="agree" value="1" />
			<?php } ?>I have read and agree to the <a href="#" style="color:#6CF">Privacy Policy</a></li>
          </ul>
         </td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
    </table>

                </td>
                <td width="45" rowspan="2" style="background:url(catalog/view/theme/default/images/register_right.png)"></td>
              </tr>
              <tr>
                <td height="30" align="center" bgcolor="#ededed">
				    <input type="submit" style="background:url(catalog/view/theme/default/images/login.png);line-height:28px;width:68px;height:28px;border:0px;cursor:pointer" value="<?php echo $button_continue; ?>" />
				    <input type="reset" style="background:url(catalog/view/theme/default/images/reset.png);line-height:28px;width:68px;height:28px;border:0px;cursor:pointer" value="Reset" />
                </td>
              </tr>
              <tr>
                <td colspan="3" height="40" style="background:url(catalog/view/theme/default/images/register_bottom.png)"></td>
              </tr>
            </table>
            </form>
            <div class="register_tip">
				<ul>
                     <li>
					<a href="<?php echo $login;?>">Welcome<p>Account Login</p></a>
				    </li>
				    <li>
					<a href="<?php echo $forgotten; ?>">Forget Your<p>Password</p></a>
				    </li>
				    <li>
					<a href="<?php echo $register; ?>">New<p>Account</p></a>
				    </li>
              </ul>
          </div>
      </div>
    </div>
<script type="text/javascript"><!--
	$('select[name=\'country_id\']').bind('change', function() {
		$.ajax({
			url: 'index.php?route=account/register/country&country_id=' + this.value,
			dataType: 'json',
			beforeSend: function() {
				$('select[name=\'country_id\']').after('<span class="wait">&nbsp;<img src="catalog/view/theme/default/image/loading.gif" alt="" /></span>');
			},
			complete: function() {
				$('.wait').remove();
			},			
			success: function(json) {
				if (json['postcode_required'] == '1') {
					$('#postcode-required').show();
				} else {
					$('#postcode-required').hide();
				}
				
				html = '<option value=""><?php echo $text_select; ?></option>';
				
				if (json['zone'] != '') {
					for (i = 0; i < json['zone'].length; i++) {
					html += '<option value="' + json['zone'][i]['zone_id'] + '"';
					
						if (json['zone'][i]['zone_id'] == '<?php echo $zone_id; ?>') {
						html += ' selected="selected"';
					}
		
					html += '>' + json['zone'][i]['name'] + '</option>';
					}
				} else {
					html += '<option value="0" selected="selected"><?php echo $text_none; ?></option>';
				}
				
				$('select[name=\'zone_id\']').html(html);
			},
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n" + xhr.responseText);
			}
		});
	});

	$('select[name=\'country_id\']').trigger('change');
//--></script>
<?php echo $footer; ?>